package net.midnighttd.game.view;

import net.midnighttd.game.entity.Tower;
import net.midnighttd.engine.entity.Entity;

import javax.swing.*;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.Border;
import java.awt.*;

/**
 * Author: Adam Scarr
 * Date: 21/04/2009
 * Time: 6:40:18 PM
 */
public class EntityDetail extends JPanel {
    public EntityDetail(Entity entity) {
        System.out.println("Tower visiblity " + entity.isActive());
        setBackground(new Color(225, 240, 220));

        Border border = BorderFactory.createLineBorder(new Color(40,35,32));
        Border margin = new EmptyBorder(10,10,10,10);
        setBorder(new CompoundBorder(border, margin));

        BorderLayout layout = new BorderLayout(15,15);
        
        setLayout(layout);

        JPanel infoPanel = new JPanel();
        infoPanel.setBackground(this.getBackground());
        infoPanel.setLayout(new GridLayout(4,1));

        JLabel name = new JLabel(entity.getName());
        infoPanel.add(name, BorderLayout.NORTH);

        JTextArea description = new JTextArea(entity.getDescription());
        description.setLineWrap(true);
        description.setWrapStyleWord(true);
        description.setBackground(null);
        infoPanel.add(description, BorderLayout.CENTER);

        add(infoPanel, BorderLayout.NORTH);
    }

}
